package com.sys.servlet;

import com.sys.dao.sysDao;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet(name = "getUserServlet", urlPatterns = "/sys/getUser", description = "获取用户列表")
public class getUserServlet extends sysServlet {

  @Override
  protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    setHeadHtml(req, resp, "getUserServlet");
    sysDao dao = new sysDao();
    PrintWriter out = resp.getWriter();
    int userType = 9999;
    try {
      userType = Integer.valueOf(req.getParameter("userType"));
    } catch (Exception ignored) {
    }

    dao.getUser(userType, out::print);
  }
}
